<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('部门管理历史')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-editable-css"/>
</head>
<body class="gray-bg">
<form id="user-form" AUTOCOMPLETE="OFF">
    <div class="modal inmodal fade" id="myModal1" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span
                            class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title">选择生效期间</h4>
                </div>
                <div class="modal-body">
                    <p>
                        生效日期从:
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input type="text" id="Bgdate" class="form-control laydate-demo-2" placeholder="yyyy-MM-dd">
                    </div>
                    </p>
                    <p>
                        生效日期到:
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input type="text" id="EDdate" class="form-control laydate-demo-1" placeholder="yyyy-MM-dd">
                    </div>
                    </p>
                </div>
                <div class="modal-footer">
                    <button type="button" id="missmodal1" class="btn btn-white" data-dismiss="modal">关闭</button>
                    <button type="button" onclick="getData()" class="btn btn-primary">确认</button>
                </div>
            </div>
        </div>
    </div>
    <button type="button" id="modal1" class="btn btn-primary" data-toggle="modal"
            data-target="#myModal1">选择时间段
    </button>


    <div class="ui-layout-center">
        <div class="container-div">
            <div class="row">
                <div class="col-sm-12 search-collapse">
                    <div class="select-list">
                        <ul>
                            <li>
                                工号：<input type="text" name="badge"/>
                            </li>
                            <li>
                                姓名：<input type="text" name="name"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </div>

                <div class="btn-group-sm" id="toolbar" role="group">
                </div>

                <div class="col-sm-12 select-table table-striped">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</form>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<th:block th:include="include :: datetimepicker-js"/>


<script th:inline="javascript">
    var prefix = ctx + "depart/admin";
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 800) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 350});
        $(".datetimepicker-demo-2").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-2',
                type: 'date'
            });
        });

        $(".datetimepicker-demo-1").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-1',
                type: 'date'
            });
        });
        $("#modal1").attr("style", "display:none;");
        $("#modal1").click();
    });

    function getData() {
        $("#missmodal1").click();
        var Bgdate = $("#Bgdate").val();
        var EDdate = $("#EDdate").val();
        var columns = [];
        var checkbox = {checkbox: true};
        var DepCode = {field: 'DepCode', title: '部门代码'};
        var typeTitle = {field: 'typeTitle', title: '部门名称'};
        var depAbbr = {field: 'depAbbr', title: '部门简称'};
        var DepGradeTitle = {field: 'DepGradeTitle', title: '部门级别'};
        var DepTypeTitle = {field: 'DepTypeTitle', title: '部门类型'};
        var compTitle = {field: 'compTitle', title: '所属公司'};
        var DepCostTitle = {field: 'DepCostTitle', title: '成本中心'};
        var AdminIdTitle = {field: 'AdminIdTitle', title: '行政上级部门'};
        var funcationIdTitle = {field: 'funcationIdTitle', title: '职能上级部门'};
        var DirectorName = {field: 'DirectorName', title: '部门负责人'};
        var Director2Name = {field: 'Director2Name', title: '部门分管领导'};
        var remark = {field: 'remark', title: '备注'};
        var EffectDate = {field: 'EffectDate', title: '成立日期'};
        var RegByName = {field: 'RegByName', title: '登记人'};
        var RegDate = {field: 'RegDate', title: '登记时间'};
        var Initialized = {field: 'Initialized', title: '?确认'};
        var InitializedByName = {field: 'InitializedByName', title: '确认人'};
        var InitializedTime = {field: 'InitializedTime', title: '确认时间'};
        var Closed = {field: 'Closed', title: '?封存'};
        var ClosedByName = {field: 'ClosedByName', title: '封存人'};
        var ClosedTime = {field: 'ClosedTime', title: '封存时间'};
        var ezid = {field: 'ezid', title: '人事区域'};

        columns.push(checkbox, DepCode, typeTitle, depAbbr, DepGradeTitle, DepTypeTitle, compTitle, DepCostTitle);
        columns.push(AdminIdTitle, funcationIdTitle, DirectorName, Director2Name, remark, EffectDate, RegByName);
        columns.push(RegDate, Initialized, InitializedByName, InitializedTime, Closed, ClosedByName, ClosedTime, ezid);


        var options = {
            code: "id",
            uniqueId: "id",
            url: prefix + "/findDataHistory?Bgdate=" + Bgdate + "&EDdate=" + EDdate,
            height: $(window).height() - 120,
            createUrl: prefix + "/add",
            modalName: "部门管理历史",
            columns: columns
        };
        $.table.init(options);
    }
</script>
</body>
</html>